home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / UTIL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  774 b   |  33 lines

  1. /*  util.c - utility functions needed by merge programs */
  2. #include   "stdio.h"
  3. #include   "cminor.h"
  4.  
  5. int  swap_str(s1,s2)        /* swap two strings */
  6.   char    s1[] ;
  7.   char    s2[] ;
  8.   {
  9.      char  t[68] ;        /* scratch space for one string */
  10.  
  11.      strcpy(t ,s1) ;        /* exchange strings */
  12.      strcpy(s1,s2) ;        /* assumes that there is room */
  13.      strcpy(s2,t ) ;
  14.   }
  15.  
  16.                 /* make up a scratch file name */
  17. int  mkname(file_name,prefix,run_no)
  18.   char    file_name[]  ;        /* store file name here */
  19.   char    prefix[] ;        /* something like "scra" */
  20.   int    run_no ;        /* append this number to prefix */
  21.   {
  22.      sprintf(file_name,"%s.%03d",prefix,run_no) ;
  23.   }
  24.  
  25.  
  26. delfile(file_spec)        /* delete a file */
  27.   char    file_spec[] ;
  28.   {
  29.      unlink(file_spec) ;
  30.   }
  31.  
  32.  
  33.